# 腾讯疫情实时地图

import requests
import json



def covid_ask(country):
    url='https://api.inews.qq.com/newsqa/v1/automation/foreign/country/ranklist'

    html=requests.get(url)
    content=json.loads(html.text)
    con_dat = content['data']
    #print(content['data'])
    list = []
    for i in range(len(content['data'])):
        for_list = []    
        for_list.append(con_dat[i]['name'])#国家
        for_list.append(con_dat[i]['date'])#日期
        for_list.append(con_dat[i]['isUpdated'])#更新
        for_list.append(con_dat[i]['confirm'])#确认
        for_list.append(con_dat[i]['dead'])#死亡
        for_list.append(con_dat[i]['heal'])#治愈
        list.append(for_list)
    
    print(list)
    for i in list:
        if country in i[0]:
            return i
    #print(i)
    #return 'error country'








if __name__ == "__main__":
    covid_ask('日本')



#-------------------------------------------#

# for i in range(len(content['data'])):
#      df.loc[i+1]=[content['data'][i]['name'],content['data'][i]['confirm'],
#                   content['data'][i]['dead'],content['data'][i]['heal']]

# country = con_dat[i]['name']
    # date = con_dat[i]['date']
    # isUpdated = con_dat[i]['isUpdated']
    # confirm = con_dat[i]['confirm']
    # dead = con_dat[i]['dead']
    # heal = con_dat[i]['heal']